{include file="header/index" /}
<div class="newContentBox">
    <div class="fixedFather">
        <div class="fix">
            申请详情
            <div class="newFixBtnBox">
                {if condition="$data.apply_status eq 1"}
                <button type="button" class="newBtnDefault newBtnGray check_btn" onclick="auditing({$data.id})"><i
                        class="fa fa-check-circle"></i>审核
                </button>
                {/if}
                {if condition="$data.sign_contract_status eq 2"}
                <a class="layui-btn newBtnDefault" href="{$data.contract_content}" target="view_window">电子合同</a>
                {/if}
                <button type="button" class="newBtnDefault newBtnGray" onclick="returnBackSession(this)"><i
                        class="fa fa-mail-reply"></i>返回
                </button>
            </div>
        </div>
    </div>
</div>
<div class="workDetail">
    <div class="workLeft">
        <!-- 基本信息 -->
        <div class="workTitle" id="information">
            <img class="iconTitleimg iconTimg2" src="__IMG__/ordericon1.png"> 基本信息
        </div>
        <div class="work_left_conten">
            <div class="work_left_oneBox">
                <p>姓名：{$data.username}</p>
                <p>手机号：{$data.phone}</p>
                <p>身份证号：{$data.id_card}</p>
                <p>现居住地址：{$data.address}</p>
                <p>推荐人：{$data.parent.telphone}(账号:{$data.parent.account})</p>
                <p>申请状态：
                    {if $data.apply_status ==1}
                    <span class="check_status" style="color: #DF0101;">{$data.apply_status_desc}</span>
                    {else/}
                    <span class="check_status">{$data.apply_status_desc}</span>
                    {/if}
                </p>
            </div>
        </div>

        <div class="workTitle" id="environment_info">
            <img class="iconTitleimg" src="__IMG__/ordericon3.png"> 身份证正反面
        </div>
        <div class="work_left_conten">
            <div class="newCard" onclick="preview(this)" style="margin-right: 80px">
                <img class="enlarge newCardPic" src="{$data.front_idcard_pic}" width="250px" height="150px">
                <div class="newText"><img src="__IMG__/icon13.png" class="icon3">查看大图</div>
            </div>
            <div class="newCard" onclick="preview(this)">
                <img class="enlarge newCardPic" src="{$data.back_idcard_pic}" width="250px" height="150px">
                <div class="newText"><img src="__IMG__/icon13.png" class="icon3">查看大图</div>
            </div>

        </div>

    </div>
    <!-- 轨迹 -->
    <div class="workRight">
        <div class="rightWorkBox">
            <p class="cover_p_right_one"><img class="iconTitleimg iconTimg2" src="__IMG__/ordericon12.png"> 申请轨迹</p>
           {if !empty($log)}
            {foreach $log as $k => $v}
            {if $k==0}
            <div class="oneWorkoOne">
                <div class="one_worke_le"><i class="fa fa-dot-circle-o"></i></div>
                <div class="one_worke_ri one_worke_ri_font">
                    <div class="">{$v.admin_remark}</div>
                    <div class="">{$v.add_time}</div>
                </div>
            </div>
            {else /}
            <div class="oneWorkoOne">
                <div class="one_worke_le colorGray"><i class="fa fa-dot-circle-o"></i></div>
                <div class="one_worke_ri">
                    <div class="">{$v.remark}</div>
                    <div class="">{$v.add_time}</div>
                </div>
            </div>
            {/if}
            {/foreach}
            {/if}
        </div>
    </div>
</div>

<script>
    // *****************************初始化处理页面***********************************
    $(function() {
        // 顶部导航控制在最顶部
        $("#overflow", parent.document).scrollTop(0);
    });
    // *****************************初始化处理页面 end***********************************

    // ****************************处理函数******************************************

    function auditing(id) {
        var power = $("#power").val();
        if (power == '0'){
            layer.msg('您还没有审核的权限！',{icon:2,time:1500,shade: 0.1,});
            return false;
        }

        var html = '';
        html += '<form class="layui-form popBox" action="" method="post"  >';
        html += '<div class="popChoose">';
        html += '<div class="leftPop">处理状态</div>';
        html += '<div class="rightPop">';
        html += '<div class="selectBox">';
        html += '<select id="_orderStatus" class="layui-input cover_layui_i">';
        html += '<option value="">选择状态</option>';
        html += '<option value="1">申请通过</option>';
        html += '<option value="2">申请拒绝</option>';
        html += '</select>';
        html += '</div>';
        html += '</div>';
        html += '</div>';

        html += '<div class="popChoose">';
        html += '<div class="leftPop">备注</div>';
        html += '<div class="rightPop">';
        html += '<textarea placeholder="请输入内容" class="layui-textarea" id="remarks"></textarea>';
        html += '</div>';
        html += '</div>';

        html += '</form>';
        parent.layer.open({
            title: '推广申请审核',
            type: 1,
            area: ['823px', '490px'], //宽高
            fixed: false,
            shadeClose: true, //点击遮罩关闭
            content: html,
            btn: ['确认', '取消'],
            btnAlign: 'c',
            success: function (layero, index) {
                parent.form.render();

            },
            yes: function (index, layero) {

                var status = $(layero).find("#_orderStatus option:selected").val();
                var status_name = $(layero).find("#_orderStatus option:selected").text();
                var remarks = $(layero).find("#remarks").val();
                if (status == '') {
                    parent.layer.msg('请选择处理状态', {
                        time: 1000,
                        icon: 0
                    });
                    return false;
                }
                var data = {};
                data.id = id;
                data.status = status;
                data.remarks = remarks;
                data = JSON.stringify(data);
                $.post("{:config('api')}/Achievement/Dealer/auditing",data,function (flag) {
                    parent.layer.close(index);
                    if (flag.code < 0){
                        parent.layer.msg(flag.message,{icon:2,time:1500,shade: 0.1,});
                        return false;
                    }
                    $(".check_status").text(status_name);
                    $(".check_btn").hide();
                    parent.layer.msg(flag.message,{icon:1,time:1500,shade: 0.1,});
                });
                parent.layer.close(index);
            },
            btn2: function (index, layero) {
                //按钮【按钮二】的回调
                // return false;//开启该代码可禁止点击该按钮关闭
            },
            cancel: function () {
                //右上角关闭回调
                //return false 开启该代码可禁止点击该按钮关闭
            }
        });

    }

    //图片预览
    $('.enlarge').click(function() {
        var imgUrl = $(this).attr('src');
        var Width = $(document.body).width();
        var Height = $(window.parent.document.body).height();
        var height;
        if (Width >= 1920) {
            width = 1920;
        } else {
            width = Width;
        }
        if (Height >= 800) {
            height = 800;
        } else {
            height = Height;
        }
        var html = "<div style='max-width:" + width + "px;max-height:" + height + "px'>" +
            "<img src='" + imgUrl + "' style='max-width:" + width + "px;max-height:" + height + "px'> " +
            "</div>";
        parent.layer.open({
            type: 1,
            shade: 0.8,
            shadeClose: true,
            title: false, //不显示标题
            area: ['auto', 'auto'],
            content: html, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
            cancel: function() {
                //layer.msg('图片查看结束！', { time: 5000, icon: 6 });
            }
        });
    })


    // 大图预览
    function preview(obj) {
        var imgUrl = $(obj).find('.newCardPic').attr('src');
        var Width = $(document.body).width();
        var Height = $(window.parent.document.body).height();
        var height;
        if (Width >= 1920) {
            width = 1920;
        } else {
            width = Width;
        }
        if (Height >= 800) {
            height = 800;
        } else {
            height = Height;
        }
        var html = "<div style='max-width:" + width + "px;max-height:" + height + "px'>" +
            "<img src='" + imgUrl + "' style='max-width:" + width + "px;max-height:" + height + "px'> " +
            "</div>";
        parent.layer.open({
            type: 1,
            shade: 0.8,
            shadeClose: true,
            title: false, //不显示标题
            area: ['auto', 'auto'],
            content: html, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
            cancel: function() {
                //layer.msg('图片查看结束！', { time: 5000, icon: 6 });
            }
        });
    }

    // ****************************处理函数 end******************************************
</script>
